import { createStore } from 'vuex'

export default createStore({
  state: {
    datavColors: ['rgb(46, 96, 153)', 'rgb(124, 231, 253)'],
    theme: 0,
    expires_time: sessionStorage.getItem('expires_time') || null,//token过期时间
    ACCESS_TOKEN: sessionStorage.getItem('access_token') || null,
    REFRESH_TOKEN: sessionStorage.getItem('refresh_token') || null,
  },
  getters: {
  },
  mutations: {
    changeDatavColors(state, value) {
      state.datavColors = value
    },
    changeTheme(state, value) {
      state.theme = value
    },
    changeExpires_time(state, value) {
      state.expires_time = value
      sessionStorage.setItem('expires_time', value)
    },
    changeACCESS_TOKEN(state, value) {
      state.ACCESS_TOKEN = value
      sessionStorage.setItem('access_token', value)
    },
    changeREFRESH_TOKEN(state, value) {
      state.REFRESH_TOKEN = value
      sessionStorage.setItem('refresh_token', value)
    },
  },
  actions: {
  },
  modules: {
  }
})
